#pragma once

#include "OpaqueBehavior.h"


namespace uml {

OpaqueBehavior::OpaqueBehavior(const QString& umlType)
    : Behavior(umlType) {}

void OpaqueBehavior::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Behavior::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(bodys_, "bodys", json, errorList);
    JsonSerializable::fromJsonArray(languages_, "languages", json, errorList);
}

void OpaqueBehavior::toJson(QJsonObject& json) {
    Behavior::toJson(json);
    JsonSerializable::toJsonArray(bodys_, "bodys", json);
    JsonSerializable::toJsonArray(languages_, "languages", json);
}

/// <summary>
/// bodys getter
/// Specifies the behavior in one or more languages.
/// </summary>
vector<QString>& OpaqueBehavior::bodys() {
    return bodys_;
}

/// <summary>
/// languages getter
/// Languages the body strings use in the same order as the body strings.
/// </summary>
vector<QString>& OpaqueBehavior::languages() {
    return languages_;
}

} // namespace uml
